<template>
  <div class="app-container code-sharing">
    <div class="project-slide _flex">
      <div class="slide-til">开源项目共建</div>
      <div class="peoject-class">
        <div
          class="class-item"
          :class="{ active: activeClass == i.value }"
          v-for="i in classList"
          :key="i.value"
        >
          <img :src="utl" alt="" />
          {{ i.label }}
        </div>
      </div>
    </div>
    <div class="project-main">
      <div class="search-box">
        <el-input
          v-model="keyWords"
          placeholder="请输入关键词进行搜索"
        ></el-input>
        <el-button type="primary" icon="el-icon-search">搜索</el-button>
        <el-button type="warning">上传项目</el-button>
      </div>
      <div class="el-tabs">
        <div class="el-tab-item active">综合排序</div>
        <div class="el-tab-item">最近更新</div>
        <div class="el-tab-item">使用最多</div>
      </div>
      <card v-for="i in 5" :key="i" />
      <div class="paging">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="400"
        >
        </el-pagination>
      </div>
    </div>
    <div class="project-slide nobackground">
      <div class="slide-item">
        <div class="slide-til">热门项目</div>
        <slideCard />
        <slideCard />
        <slideCard />
      </div>
      <div class="slide-item">
        <div class="slide-til">共建案例</div>
        <slideCard />
        <slideCard />
        <slideCard />
      </div>
    </div>
  </div>
</template>

<script>
import card from './projectCard.vue'
import slideCard from './slideCard.vue'
export default {
  name: 'Index',
  components: {
    card,
    slideCard
  },
  data () {
    return {
      // 版本号
      version: '3.8.8',
      currentPage4: 1,
      activeName: 'first',
      keyWords: '',
      utl: 'https://inews.gtimg.com/om_bt/O6SG7dHjdG0kWNyWz6WPo2_3v6A6eAC9ThTazwlKPO1qMAA/641',
      activeClass: 1,
      classList: [
        {
          label: '综合推荐',
          value: 1
        },
        {
          label: '前沿技术',
          value: 2
        },
        {
          label: 'openHarmony',
          value: 3
        },
        {
          label: '人工智能',
          value: 4
        },
        {
          label: '区块链',
          value: 5
        },
        {
          label: 'CIM',
          value: 6
        },
        {
          label: '一标三实',
          value: 7
        },
        {
          label: '手机/移动开发',
          value: 8
        },
        {
          label: '智能驾驶',
          value: 9
        }
      ]
    }
  },
  methods: {
    goTarget (href) {
      window.open(href, '_blank')
    }
  }
}
</script>

<style scoped lang="scss">
.slide-item {
  background: #fff;
  &:last-of-type {
    margin-top: 24px;
  }
  .slide-til {
    height: 53px;
    line-height: 53px;
    padding: 0 24px;
    color: rgb(82, 88, 102);
    font-family: 思源黑体;
    font-size: 20px;
    font-weight: 700;
    line-height: 29px;
    letter-spacing: 0px;
    text-align: left;
  }
}
.paging {
  padding: 24px;
  text-align: center;
  margin-bottom: 46px;
}
.code-sharing {
  padding: 24px 100px;
  background: rgb(247, 248, 251);
  display: grid;
  grid-template-columns: 362px 1fr 362px;
  grid-gap: 24px 24px;
  > div {
    &:not(.nobackground) {
      background: #fff;
    }
    &.project-main {
      .search-box {
        display: flex;
        padding: 10px;
        ::v-deep .el-button--primary {
          margin: 0 0px 0 10px;
        }
      }
      .el-tabs {
        display: flex;
        align-items: center;
        color: rgb(68, 75, 86);
        font-family: HarmonyOS Sans SC;
        font-size: 20px;
        font-weight: 500;
        line-height: 24px;
        letter-spacing: 0px;
        text-align: center;
        position: relative;
        &::after {
          content: '';
          display: block;
          width: 100%;
          height: 1px;
          position: absolute;
          left: 0;
          bottom: 0;
          background: rgb(190, 213, 255);
        }
        .el-tab-item {
          height: 42px;
          width: 88px;
          text-align: center;
          position: relative;
          line-height: 42px;
          margin-right: 22px;
          cursor: pointer;
          &.active {
            color: rgb(13, 134, 255);
            &::after {
              content: '';
              display: block;
              width: 100%;
              height: 3px;
              background: rgb(13, 134, 255);
              position: absolute;
              left: 0;
              bottom: -1px;
              z-index: 9;
            }
          }
        }
      }
    }
    &.project-slide {
      height: 906px;
      box-sizing: border-box;
      &._flex {
        display: flex;
        flex-direction: column;
        padding: 8px 0;
        .peoject-class {
          height: 0;
          flex: 1;
          color: rgb(68, 75, 86);
          font-family: 思源黑体;
          font-size: 20px;
          font-weight: 400;
          line-height: 24px;
          letter-spacing: 0px;
          text-align: left;
          > div {
            height: 40px;
            display: flex;
            align-items: center;
            padding-left: 87px;
            &.active {
              background: rgba(43, 111, 255, 0.1);
              color: rgb(43, 111, 255);
            }
            img {
              height: 18px;
              width: 18px;
              margin-right: 16px;
            }
          }
        }
      }
      .slide-til {
        padding: 8px 18px;
        color: rgb(51, 51, 51);
        font-family: 思源黑体;
        font-size: 24px;
        font-weight: 400;
        line-height: 24px;
        letter-spacing: 0px;
        text-align: left;
        margin-bottom: 10px;
      }
    }
  }
}
</style>
